<template>
  <div>
    <br />
    <br />

    <div class="bottom">
      <p>
        <input
          @change="checkAll"
          v-model="flag"
          type="checkbox"
          name=""
          id=""
        />
      </p>
      <p>总价 {{ $store.getters.microscope }}</p>
      <p v-if="$store.state.editFlag" >去支付 {{ $store.getters.total }}</p>
      <p @click="removeCheck" v-else>
        删除选中({{ $store.getters.trueLength }})
      </p>
    </div>
  </div>
</template>

<script>
import { computed } from "vue";
import { useStore } from "vuex";
export default {
  setup() {
    let store = useStore();
    let flag = computed(() => store.state.flag);
    function checkAll() {
      console.log(event.target.checked);
      store.commit("checkAll", event.target.checked);
    }
    function removeCheck() {
      store.commit("removeCheck",);
    }
    return { flag, checkAll,removeCheck };
  },
};
</script>

<style lang="scss" scoped>
[type="checkbox"] {
  width: 20px;
  height: 20px;
}
.bottom {
  width: 100%;
  height: 40px;
  background-color: rgb(240, 33, 33);
  display: flex;
  align-items: center;
  justify-content: space-around;
  color: #fff;
  position: fixed;
  bottom: 0;
  left: 0;
}
</style>
